<HTML><HEAD><TITLE>pragma(+Option)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Directives</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>pragma(+Option)</H1>
Enable or disable compilation or other source processing options.
<DL>
<DT><EM>Option</EM></DT>
<DD>An atom.
</DD>
</DL>
<H2>Description</H2>
   The pragma/1 directive allows to control various compiler options, or
   other source processing options.  A pragma can only be used as a
   directive in source files or lists given to compile_term/1,2.
   The effect of a pragma is local to a source file (unlike set_flag/2).
   Settings are in effect until the next pragma that overrides it or until
   the end of the file.
<PRE>
    Option     Effect
   ---------------------------------------------------------------
    [no]debug        generate debuggable code
    [no]expand       do goal expansion/inline compilation
    opt_level(N)     set optimizer level (N>=0)
    [no]skip         set the skipped flag for all compiled predicates
    system           set the type of all compiled predicates to 'built_in'
    [no]warnings     generate compiler warnings
</PRE>
   The default for debug/nodebug depends on the global flag debug_compile
   and the debug compiler option.
   The default for expand/noexpand depends on the global flag goal_expansion
   and the expand_goals compiler option.
   The default for opt_level depends on the opt_level compiler option.
   The default for skip is off. The default for warnings is on.
   The global flags are set with set_flag/2 and tested with get_flag/2.
<P>
   Pragmas which the compiler does not recognise are silently ignored by
   the compiler, but are recorded and can be retrieved using current_pragma/1.
   Such pragmas can be atoms or structures with arbitrary arguments.
<P>

<H3>Modes and Determinism</H3><UL>
<LI>pragma(+) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(148) bad pragma </EM>
<DD>An unknown Option was given.
</DL>
<H2>Examples</H2>
<PRE>
:- pragma(debug).
:- pragma(expand).
twice(X, Y) :-      % this is compiled into debuggable
    Y is 2*X.       % code with expanded arithmetic



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/compiler/compile-1.html">compile / 1</A>, <A HREF="../../kernel/env/env-0.html">env / 0</A>, <A HREF="../../kernel/env/get_flag-2.html">get_flag / 2</A>, <A HREF="../../kernel/compiler/get_flag-3.html">get_flag / 3</A>, <A HREF="../../kernel/env/pred-1.html">pred / 1</A>, <A HREF="../../kernel/compiler/set_flag-3.html">set_flag / 3</A>, <A HREF="../../kernel/env/set_flag-2.html">set_flag / 2</A>, <A HREF="../../kernel/debug/skipped-1.html">skipped / 1</A>, <A HREF="../../kernel/debug/unskipped-1.html">unskipped / 1</A>, <A HREF="../../kernel/compiler/current_pragma-1.html">current_pragma / 1</A>
</BODY></HTML>
